package org.fight.logic.fightbo;

import org.utils.ProtoUnit;

import com.google.protobuf.GeneratedMessage;
import com.sojoys.artifact.factory.message.IMessage;
import com.sojoys.artifact.factory.session.ISession;
import com.sojoys.artifact.manager.MessageManager;

/**
 * @author : DengYing
 * @CreateDate : 2018年3月1日 下午12:21:09
 * @Description ：Please describe this document
 */
public class FightPlayer {
	private int pid;

	private ISession session;

	public int getPid() {
		return pid;
	}

	public void setPid(int pid) {
		this.pid = pid;
	}

	public ISession getSession() {
		return session;
	}

	public void setSession(ISession session) {
		this.session = session;
	}

	public void sendMsg(short commandId,GeneratedMessage msg ){
		if (session!=null) {
			session.sendMessage(MessageManager.me().create(commandId, ProtoUnit.toByte(msg)));
		}
	}

	public void sendMsg(IMessage msg){
		if (session!=null) {
			session.sendMessage(msg);
		}
	}
}
